<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:mo="https://gitee.com/aun/Timo">
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
</head>
<body class="timo-layout-page">
    <div class="layui-card">
        <div class="layui-card-header  timo-card-header">
            <span><i class="fa fa-bars"></i> 商户个人渠道管理管理</span>
            <i class="layui-icon layui-icon-refresh refresh-btn"></i>
        </div>
        <div class="layui-card-body">
            <div class="layui-row timo-card-screen">
                <div class="pull-left layui-form-pane layui-form timo-search-box">
                    <div class="layui-inline">
                        <label class="layui-form-label">渠道名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="channelName" th:value="${param.channelName}" placeholder="请输入渠道名称" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">渠道账号</label>
                        <div class="layui-input-block">
                            <input type="text" name="channelMchAccount" th:value="${param.channelMchAccount}" placeholder="请输入渠道个人账号" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">是否在线</label>
                        <div class="layui-input-block" style="width: 120px;">
                            <select name="loginState">
                                <option value="">==请选择==</option>
                                <option value="1" th:selected="${param.loginState?.toString()} eq '1'">在线</option>
                                <option value="2" th:selected="${param.loginState?.toString()} eq '2'">离线</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">渠道用户ID</label>
                        <div class="layui-input-block">
                            <input type="text" name="channelUserId" th:value="${param.channelUserId}" placeholder="请输入渠道用户ID" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn timo-search-btn">
                            <i class="fa fa-search"></i>
                        </button>
                    </div>
                </div>
                    <div class="pull-right screen-btn-group">
                        <button class="layui-btn open-popup" data-title="添加商户个人渠道管理" th:attr="data-url=@{/pPayPersonMch/add}"  data-size="600,500">
                            <i class="fa fa-plus"></i>添加</button>
                    </div>

            </div>
            <table class="layui-table timo-table">
                <thead>
                <tr>
                    <th class="timo-table-checkbox">
                        <label class="timo-checkbox"><input type="checkbox">
                            <i class="layui-icon layui-icon-ok"></i></label>
                    </th>
                    <!--<th>渠道编码</th>-->
                    <th>渠道名称</th>
                    <th>渠道个人账号</th>
                    <th>渠道用户ID</th>
                    <th>是否在线</th>
                    <th>今日使用额度</th>
                    <th>每日收款金额</th>
                    <th>渠道状态</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="item:${list}">
                    <td><label class="timo-checkbox"><input type="checkbox" th:value="${item.personMchId}">
                        <i class="layui-icon layui-icon-ok"></i></label></td>
                   <!-- <td th:text="${item.channelNo}">渠道编码</td>=null?'在线':'离线' -->
                    <td th:text="${item.channelName}">渠道名称</td>
                    <td th:text="${item.channelMchAccount}">渠道账号</td>
                    <td th:text="${item.channelUserId}">渠道用户ID</td>
                    <td th:class="${item.loginState== '1'}?'layui-bg-blue':'layui-bg-red'" th:text="${item.loginState=='1'}?'在线':'离线'">在线状态</td>
                    <td th:text="${item.todayAmount/100.0}">今日使用额度</td>
                    <td th:text="${item.maxAmount/100.0}">每日最大收款金额</td>
                    <td th:text="${#dicts.value(item.state)}">渠道状态</td>
                    <td>
                        <a class="open-popup" data-title="编辑商户个人渠道管理" th:attr="data-url=@{'/pPayPersonMch/edit/'+${item.personMchId}}"  data-size="600,500" href="#">编辑</a>
                        <a class="open-popup" data-title="详细信息" th:attr="data-url=@{'/pPayPersonMch/detail/'+${item.personMchId}}"  data-size="600,500" href="#">详细</a>
                        <a class="ajax-get" data-msg="您是否确认删除" th:href="@{/pPayPersonMch/status/delete(ids=${item.personMchId})}">删除</a>
                        <a th:if="${item.loginState == '2'}" href="javascript:void();" onclick="logoutUser();"></a>
                    </td>
                </tr>
                </tbody>
            </table>
            <div th:replace="/common/fragment :: page"></div>
        </div>
    </div>
<script th:replace="/common/template :: script"></script>
<script>
    function logoutUser(){
        layer.confirm('您确认手动下线该用户吗？', {
            btn: ['确认','取消'] //按钮
        }, function(){
            $.post('/pPayPersonMch/logut', {orderId:data.orderId}, function (result) {
                $.fn.Messager(result);
            });
        }, function(){
        });
    }
</script>
</body>
</html>
